import React, { Component } from 'react'
import { Text, StyleSheet, View, Button, } from 'react-native'

import commonStyle from '../styles/common'

import NavigationUtil from '../Navigation/NavigationUtil'

export default class Welcom extends Component {

  componentDidMount(){
    this.timer = setTimeout(()=>{
      const { navigation } = this.props
      navigation.reset({
        index:0,
        routes: [{ name: 'home' }],
      })
    },2000)
  }

  componentWillUnmount(){
    this.timer && clearTimeout(this.timer )
  }


  render() {

    const { navigation, } = this.props

    return (
      <View style={commonStyle.container}>
        <Text> Welcom </Text>
        <Button
          title="跳转首页"
          onPress={() => navigation.reset({
            index:0,
            routes: [{ name: 'home' }],
          })}
        />
      </View>
    )
  }
}

const styles = StyleSheet.create({})
